package com.eastedu.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.eastedu.repository.permission.mapper.PermissionTemplateContentMapper;
import com.eastedu.repository.permission.po.PermissionTemplateContentPO;
import com.eastedu.service.AbstractPermissionDataSourceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 〈〉
 *
 * @author ZHISHUAI.ZHANG
 * @since 2021 /7/28
 */
@Slf4j
@DS("permission")
@Service("permission-template-content-source")
public class PermissionTemplateDataSourceServiceImpl extends AbstractPermissionDataSourceService<PermissionTemplateContentPO> {

    /**
     * Instantiates a new Permission template data source service.
     *
     * @param permissionTemplateContentMapper the permission template content mapper
     */
    public PermissionTemplateDataSourceServiceImpl(PermissionTemplateContentMapper permissionTemplateContentMapper) {
        super(permissionTemplateContentMapper);
        /// super.addScriptByTableName("permission_template_content");
        super.addScript("UPDATE permission_template_content t1 SET t1.sync_state = 0");
    }

    @Override
    protected void setContent(PermissionTemplateContentPO po, String jsonContent) {
        po.setContent(jsonContent);
    }

    @Override
    protected String getContent(PermissionTemplateContentPO po) {
        return po.getContent();
    }
}